﻿@{
    ViewData["Title"] = "收货查询补打";
}
<script type="text/javascript" src="~/lib/qui/thirdparty/lodop/LodopFuncs.js"></script>
<style>
    .titleName {
        font-size: 14px;
        font-weight: bold;
    }
</style>
<div class="box2" panelTitle="检索条件">
    <form id="queryForm" method="post">
        <table formMode="transparent">
            <tr>
                <td>单号：</td>
                <td><input type="text" name="refOrderNo" id="refOrderNo" /></td>
                <td>箱条码：</td>
                <td><input type="text" name="cartonNo" id="cartonNo" /></td>
                <td>库区：</td>
                <td><select selectedValue="" prompt="请选择" url="/wms/StockBarcodePrint/getZoneList" name="zoneId"></select></td>
                <td>库位：</td>
                <td><select selectedValue="" prompt="请选择" url="/wms/StockBarcodePrint/getLocateList" name="locateId"></select></td>
                <td>供应商代码：</td>
                <td><input type="text" name="vendorName" id="vendorName" /></td>
            </tr>
            <tr>
                <td>状态：</td>
                <td><select selectedValue="" prompt="请选择" url="/wms/StockBarcodePrint/getStockStatus" name="status"></select></td>
                <td>批次号：</td>
                <td><input type="text" name="lotno" id="lotno" /></td>
                <td>创建开始日期：</td>
                <td><input type="text" name="beginCreateTime" id="beginCreateTime" class="date" /></td>
                <td>创建结束日期：</td>
                <td><input type="text" name="endCreateTime" id="endCreateTime" class="date" /></td>
            </tr>
            <tr>
                <td><button type="button" onclick="searchHandler()"><span class="icon_find">查询</span></button></td>
                <td><button type="button" onclick="resetSearch()"><span class="icon_reload">重置</span></button></td>
            </tr>
        </table>
    </form>
</div>

<div>
    <div class="padding_right5">
        <div id="maingrid"></div>
    </div>
</div>
<div id="lableB" >
    <table style="width:354px; height:262.6px;font-size:12px;font-weight:800;margin-left:15px; border-collapse: collapse;border-spacing: 0; " border="1" ;>
        <tr>
            <td colspan="8" style="height:40px">
                <label id="cartonNo1" style="width:198px"></label>
            </td>
        </tr>
        <tr style="height:40px">
            <td rowspan="2" colspan="3">
                <p class="titleName">简码：</p>
                <p><label id="partSpec" style="font-size:35px"></label></p>
            </td>
            <td rowspan="2" colspan="3">
                <p class="titleName">数量：</p>
                <p><label id="qty" style="font-size:35px"></label><label id="unit" style="font-size:35px"></label></p>
            </td>
            <td colspan="2">
                <p class="titleName">交货日期：</p>
                <p><label id="planDate"></label></p>
            </td>
        </tr>

        <tr>
            <td colspan="2" style="height:20px">
                <p class="titleName">交货时间：</p>
                <p><label id="planTime"></label></p>
            </td>
        </tr>
        <tr>
            <td colspan="6" style="height:20px">
                <p class="titleName">物料编码：<label id="partNo">11</label></p>
            </td>
            <td colspan="2" style="height:20px">
                <p class="titleName">供应商代码：</p>
                <p><label id="vendorCode"></label></p>
            </td>
        </tr>
        <tr>
            <td colspan="6" style="height:20px">
                <p class="titleName">供应商名称：</p>
                <p><label id="vendorNamePrt"></label></p>
            </td>
            <td colspan="2" style="height:20px">
                <p class="titleName">客户：</p>
                <p><label id="customerCode"></label></p>
            </td>
        </tr>
        <tr>
            <td colspan="8" style="height:20px">
                <p class="titleName">物料描述：</p>
                <p><label id="partSpec2"></label></p>
            </td>
        </tr>
    </table>
</div>

<script type="text/javascript">
    var grid;
    function initComplete() {
        grid = $("#maingrid").quiGrid({
            columns: [
                { display: '单号', name: 'refOrderNo', align: 'center', width: 200, isSort: false },
                { display: '箱条码', name: 'cartonNo', align: 'center', width: 300, isSort: false }, 
                { display: '零件号', name: 'partNo', align: 'center', width: 300 },
                { display: '零件简码', name: 'partSpec', align: 'center', width: 100 },
                { display: '单位', name: 'unit', align: 'center', width: 100 },
                { display: '批次', name: 'lotNo', align: 'center', width: 100 },
                { display: '条码状态', name: 'stockStatus', align: 'center', width: 100 },
                { display: '数量', name: 'qty', align: 'center', width: 100 },
                { display: '包装数量', name: 'snpQty', align: 'center', width: 100 },
                { display: '供应商代码', name: 'vendorCode', align: 'center', width: 100 },
                { display: '供应商名称', name: 'vendorName', align: 'center', width: 150 },
                { display: '库位代码', name: 'locateName', align: 'center', width: 100 },
                { display: '库区代码', name: 'zoneName', align: 'center', width: 100 },
                { display: '仓库代码', name: 'warehouseName', align: 'center', width: 100 },
                { display: '库存地', name: 'erpWarehouse', align: 'center', width: 100 },
                { display: '分组号', name: 'groupNo', align: 'center', width: 100 },
                { display: '单号', name: 'refOrderNo', align: 'center', width: 100 },
                { display: '道口号', name: 'dock', align: 'center', width: 100 },
                { display: '工厂代码', name: 'factoryCode', align: 'center', width: 100 },
                { display: '创建日期', name: 'createTime', align: 'center', width: 200 },
                {
                    display: '冻结/正常', name: 'enabled', align: 'center', width: "150%",
                    render: function(rowdata, rowindex, value, column) {
                        if (value == "Y") {
                            return "正常";
                        } else {
                            return "冻结";
                        }
                    }
                }
            ],
            url: '/wms/StockBarcodePrint/getListByPage', sortName: 'createTime', rownumbers: true, checkbox: true,
            height: '100%', width: "100%", percentWidthMode: true, pageSize: 100,
            //顶部图标按钮栏
            toolbar: {}
        });
        //载入工具栏图标
        loadToolbar("", grid);
    }

    //查询
    function searchHandler() {
        //得到查询参数
        var query = $("#queryForm").formToArray();
        //将查询参数传给grid表格
        grid.setOptions({ params: query });
        //页号重置为1
        grid.setNewPage(1);
        //重新加载数据
        grid.loadData();
    }

    //重置查询
    function resetSearch() {
        $("#queryForm")[0].reset();
        searchHandler();
    }
    //打印
    function print() {
        debugger;
        var selectedRows = grid.getSelectedRows();
        var selectedRowsLength = selectedRows.length;
        if (selectedRowsLength == 0) {
            top.Dialog.alert("请选中要打印的记录!");
            return;
        }
        LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
        LODOP.SET_PRINT_PAGESIZE(1, 1000, 700, "");
        for (var i = 0; i < selectedRowsLength; i++) {
            LODOP.NewPage();
            $("#qty").text(selectedRows[i].qty);
            $("#unit").text(selectedRows[i].unit);
            $("#partSpec").text(selectedRows[i].partSpec);
            $("#planDate").text(selectedRows[i].planDate);
            $("#planTime").text(selectedRows[i].planTime);
            $("#partNo").text(selectedRows[i].partNo);
            $("#vendorCode").text(selectedRows[i].vendorCode);
            $("#vendorNamePrt").text(selectedRows[i].vendorName);
            $("#customerCode").text(selectedRows[i].customerCode);
            $("#partSpec2").text(selectedRows[i].partSpec2);

            LODOP.ADD_PRINT_TABLE(0, 0, 368, 264.6, document.getElementById("lableB").innerHTML);
            LODOP.ADD_PRINT_BARCODE(5, 30, 320, 30, "128Auto", selectedRows[i].cartonNo);
            //LODOP.SET_PRINT_STYLEA(0, "FontName", "39Extended");
        }
        //LODOP.PRINT_DESIGN();
        LODOP.PREVIEW();
        //LODOP.PRINT();
    }

    //获取所有选中行获取选中行的id 格式为 ids=1&ids=2
    function getSelectId(grid) {
        var selectedRows = grid.getSelectedRows();
        var selectedRowsLength = selectedRows.length;
        var ids = "";

        for (var i = 0; i < selectedRowsLength; i++) {
            ids += selectedRows[i].ruid + ",";
        }
        return { "ids": ids };
    }

    //右下角提示信息
    function showMsg(message) {
        $.messager.show(0, message, 5000);
    }

    //刷新表格数据并重置排序和页数
    function refresh(isUpdate) {
        if (!isUpdate) {
            //重置排序
            grid.options.sortName = 'createTime';
            //页号重置为1
            grid.setNewPage(1);
        }
        grid.loadData();
    }

</script>	